using Nop.Core.Plugins;
using Nop.Services.Localization;
using Nop.Web.Framework.Menu;
using System;
using System.Web.Routing;
namespace Nop.Plugin.Picture.CDN
{
    public class CDNPlugin : BasePlugin, IAdminMenuPlugin, IPlugin
    { 
        public override void Install()
        {
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.DomainNames", "CDN Hostname(s)");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.DomainNames.Hint", "Contains the Hostname(s) for CDN");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.Enable", "Enable CDN");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.Enable.Hint", "Select for Enable or Disable CDN");
            base.Install();
        }
        public override void Uninstall()
        {
            this.DeletePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.DomainNames");
            this.DeletePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.DomainNames.Hint");
            this.DeletePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.Enable");
            this.DeletePluginLocaleResource("Nop.Plugin.Picture.CDN.Field.Enable.Hint");
            base.Uninstall();
        }
        public SiteMapNode BuildMenuItem()
        {
            var menuItemBuilder = new SiteMapNode()
            {
                Title = "NopAccelerate CDN",   // Title for your Custom Menu Item
                Url = "~/Admin/Plugins/CDN/NopCDN/Configure", // Path of the action link
                //ControllerName = "NopCDN", // Your controller Name
                //ActionName = "Configure", // Action Name
                Visible = true,
                RouteValues = new RouteValueDictionary() { 
                    //{ "Namespaces", "Nop.Plugin.Picture.CDN.Controllers" },
                    {"Area", "Admin" } 
                }
            };
            return menuItemBuilder;
        }

        public bool Authenticate()
        {
            return true;
        }
    }
}
